package com.evil.kingdom.pojo.dto.person.soldier;

import com.evil.kingdom.pojo.dto.person.base.PersonTypeDto;
import com.evil.kingdom.pojo.dto.person.base.PersonDto;
import com.evil.kingdom.pojo.entity.base.Loyalty;
import com.evil.common.mongo.entity.SingleName;
import jakarta.validation.constraints.NotNull;
import lombok.Getter;
import lombok.Setter;

import java.util.Objects;

/**
 * 士兵
 *
 * @author liyang
 * @date 2024-05-17 16:34
 */
@Getter
@Setter
public class SoldierDto extends PersonDto implements SingleName, Loyalty, PersonTypeDto {

    /**
     * 归属（君主）
     *
     * @see PersonDto#getName()
     */
    private String belong;

    /**
     * 忠诚度（0-100）
     */
    private Integer loyalty;

    /**
     * 勇力值（0-100）
     */
    @NotNull(message = "勇力值不能为空")
    private Integer courage;

    /**
     * 兵种
     */
    @NotNull(message = "兵种不能为空")
    private SoldierTypeDto soldierType;

    public SoldierDto() {
    }

    public SoldierDto(String name) {
        super(name);
    }

    @Override
    public String getEntityName() {
        return "士兵";
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        if (!super.equals(o)) return false;

        SoldierDto that = (SoldierDto) o;

        return Objects.equals(this.getName(), that.getName());
    }

    @Override
    public int hashCode() {
        return super.hashCode();
    }
}
